package com.itheima.work;

/*5、【编号：1006】分析事物的共性，并抽取出正确的继承体系
现有基础班老师（BaseTeacher）和就业班老师（WorkTeacher）两个类，
两者都含有姓名和年龄两个属性，还有一个讲课的行为teach，
但不同的是，基础班老师的teach方法输出【基础班老师讲JavaSE】，
就业班老师的teach方法输出【就业班老师讲JavaEE】，
请用代码实现。 运行结果：
张三老师...23
基础班老师讲JavaSE
李四老师...24
就业班老师讲JavaEE*/
 abstract class Teacher {
    private String name;
    private int age;

    public Teacher() {
    }

    public Teacher(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    public abstract  void teach();
    public void show(){
        System.out.println(this.name+"老师..."+ this.age);
    }
}

class BaseTeacher extends Teacher {
    public BaseTeacher(){}
    public BaseTeacher(String name, int age) {
        super(name,age);
    }
    @Override
    public void teach() {
        System.out.println("基础班老师讲JavaSE");
    }
}

class WorkTeacher extends Teacher {
    public WorkTeacher(){}
    public WorkTeacher(String name, int age) {
        super(name, age);
    }

    @Override
    public void teach() {
        System.out.println("就业班老师讲JavaEE");
    }
}
public class Demo05{
    public static void main(String[] args) {
        Teacher t1 = new BaseTeacher("张三",23) ;
        Teacher t2 = new WorkTeacher("李四",24) ;
           t1.show();
           t1.teach();
           t2.show();
           t2.teach();

    }
}



